package com.tian.factory.function;

import com.tian.factory.function.factory.IFactory;
import com.tian.factory.function.factory.DaZhongFactory;
import com.tian.factory.function.factory.AoDIFactory;
import com.tian.factory.function.product.ICar;

/**
 * @author tiansongtao, Email:tiansongtao@up366.com
 * @date 2020/12/24 15:57
 *
 * 工厂方法模式
 */
public class FunctionFactoryMain {

    public static void main(String[] args) {
        IFactory oneFactory = new DaZhongFactory();
        ICar product1 = oneFactory.createProduct(IFactory.DA_ZHONG_BAO_LAI);
        ICar product2 = oneFactory.createProduct(IFactory.DA_ZHONG_SU_TENG);
        ICar product3 = oneFactory.createProduct(IFactory.DA_ZHONG_HUI_TENG);
        product1.drive();
        product2.drive();
        product3.drive();


        IFactory twoFactory = new AoDIFactory();
        ICar product4 = twoFactory.createProduct(IFactory.AO_DI_A_4);
        ICar product5 = twoFactory.createProduct(IFactory.AO_DI_A_5);
        ICar product6 = twoFactory.createProduct(IFactory.AO_DI_A_6);
        product4.drive();
        product5.drive();
        product6.drive();


    }
}
